<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户编辑</title>
    <c:import url="/layout/_imports.jsp"></c:import>
    <style>
        .role_edit h2 {
            text-align: center;
        }
        .role_edit form {
            display: flex;
            justify-content: center;
        }
    </style>
</head>
<body>
<c:import url="/layout/_nav.jsp"></c:import>
<div class="role_edit">
    <h2>编辑权限</h2>

    <form action="/role/update/${id}" method="post">
        <div class="role_main">
            <C:forEach items="${permissions}" var="p" varStatus="status">
                <C:if test="${status.index%5 == 0}" >
                    </br>
                    </br>
                </C:if>
                <input class="form-check-input" type="checkbox" name="${p.id}" id="${p.id}" ${activePermissions.contains(p.id) ? 'checked' : ''}>
                <label class="form-check-label" for="${p.id}">${p.name}</label>
            </C:forEach>

            <div style="text-align: center; margin: 20px 0">
                <button type="submit" class="btn btn-primary">保存</button>
                <a href="/role/manage" class="btn btn-secondary">返回列表</a>
            </div>
        </div>
    </form>
</div>
</body>
</html>
